3.13.16 \(\int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^2} \, dx\) [1216]

3.13.16.1 Optimal result
3.13.16.2 Mathematica [C] (verified)
3.13.16.3 Rubi [A] (verified)
3.13.16.4 Maple [A] (verified)
3.13.16.5 Fricas [B] (verification not implemented)
3.13.16.6 Sympy [C] (verification not implemented)
3.13.16.7 Maxima [A] (verification not implemented)
3.13.16.8 Giac [B] (verification not implemented)
3.13.16.9 Mupad [B] (verification not implemented)

3.13.16.1 Optimal result

Integrand size = 25, antiderivative size = 285 \[ \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^2} \, dx=\frac {\left (8 a^3 b c d-8 a b^3 c d+a^4 \left (c^2-d^2\right )-6 a^2 b^2 \left (c^2-d^2\right )+b^4 \left (c^2-d^2\right )\right ) x}{\left (c^2+d^2\right )^2}-\frac {2 \left (a^2 c-b^2 c+2 a b d\right ) \left (2 a b c-a^2 d+b^2 d\right ) \log (\cos (e+f x))}{\left (c^2+d^2\right )^2 f}-\frac {2 (b c-a d)^3 \left (a c d+b \left (c^2+2 d^2\right )\right ) \log (c+d \tan (e+f x))}{d^3 \left (c^2+d^2\right )^2 f}-\frac {b^2 \left (a d (2 b c-a d)-b^2 \left (2 c^2+d^2\right )\right ) \tan (e+f x)}{d^2 \left (c^2+d^2\right ) f}-\frac {(b c-a d)^2 (a+b \tan (e+f x))^2}{d \left (c^2+d^2\right ) f (c+d \tan (e+f x))} \]

output
(8*a^3*b*c*d-8*a*b^3*c*d+a^4*(c^2-d^2)-6*a^2*b^2*(c^2-d^2)+b^4*(c^2-d^2))* 
x/(c^2+d^2)^2-2*(a^2*c+2*a*b*d-b^2*c)*(-a^2*d+2*a*b*c+b^2*d)*ln(cos(f*x+e) 
)/(c^2+d^2)^2/f-2*(-a*d+b*c)^3*(a*c*d+b*(c^2+2*d^2))*ln(c+d*tan(f*x+e))/d^ 
3/(c^2+d^2)^2/f-b^2*(a*d*(-a*d+2*b*c)-b^2*(2*c^2+d^2))*tan(f*x+e)/d^2/(c^2 
+d^2)/f-(-a*d+b*c)^2*(a+b*tan(f*x+e))^2/d/(c^2+d^2)/f/(c+d*tan(f*x+e))
 
3.13.16.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 3.40 (sec) , antiderivative size = 222, normalized size of antiderivative = 0.78 \[ \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^2} \, dx=\frac {-\frac {i (a+i b)^4 \log (i-\tan (e+f x))}{(c+i d)^2}+\frac {i (a-i b)^4 \log (i+\tan (e+f x))}{(c-i d)^2}+\frac {4 (-b c+a d)^3 \left (a c d+b \left (c^2+2 d^2\right )\right ) \log (c+d \tan (e+f x))}{d^3 \left (c^2+d^2\right )^2}-\frac {2 (b c-a d)^2 \left (-2 a b c d+a^2 d^2+b^2 \left (2 c^2+d^2\right )\right )}{d^3 \left (c^2+d^2\right ) (c+d \tan (e+f x))}+\frac {2 b^2 (a+b \tan (e+f x))^2}{d (c+d \tan (e+f x))}}{2 f} \]

input
Integrate[(a + b*Tan[e + f*x])^4/(c + d*Tan[e + f*x])^2,x]
 
output
(((-I)*(a + I*b)^4*Log[I - Tan[e + f*x]])/(c + I*d)^2 + (I*(a - I*b)^4*Log 
[I + Tan[e + f*x]])/(c - I*d)^2 + (4*(-(b*c) + a*d)^3*(a*c*d + b*(c^2 + 2* 
d^2))*Log[c + d*Tan[e + f*x]])/(d^3*(c^2 + d^2)^2) - (2*(b*c - a*d)^2*(-2* 
a*b*c*d + a^2*d^2 + b^2*(2*c^2 + d^2)))/(d^3*(c^2 + d^2)*(c + d*Tan[e + f* 
x])) + (2*b^2*(a + b*Tan[e + f*x])^2)/(d*(c + d*Tan[e + f*x])))/(2*f)
 
3.13.16.3 Rubi [A] (verified)

Time = 1.59 (sec) , antiderivative size = 301, normalized size of antiderivative = 1.06, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.440, Rules used = {3042, 4048, 3042, 4120, 25, 3042, 4109, 3042, 3956, 4100, 16}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^2}dx\)

\(\Big \downarrow \) 4048

\(\displaystyle \frac {\int \frac {(a+b \tan (e+f x)) \left (c d a^3+4 b d^2 a^2-5 b^2 c d a+2 b^3 c^2-b \left (a d (2 b c-a d)-b^2 \left (2 c^2+d^2\right )\right ) \tan ^2(e+f x)+d \left (-d a^3+3 b c a^2+3 b^2 d a-b^3 c\right ) \tan (e+f x)\right )}{c+d \tan (e+f x)}dx}{d \left (c^2+d^2\right )}-\frac {(b c-a d)^2 (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \frac {(a+b \tan (e+f x)) \left (c d a^3+4 b d^2 a^2-5 b^2 c d a+2 b^3 c^2-b \left (a d (2 b c-a d)-b^2 \left (2 c^2+d^2\right )\right ) \tan (e+f x)^2+d \left (-d a^3+3 b c a^2+3 b^2 d a-b^3 c\right ) \tan (e+f x)\right )}{c+d \tan (e+f x)}dx}{d \left (c^2+d^2\right )}-\frac {(b c-a d)^2 (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\)

\(\Big \downarrow \) 4120

\(\displaystyle \frac {-\frac {\int -\frac {c d^2 a^4+4 b d^3 a^3-6 b^2 c d^2 a^2+4 b^3 c^2 d a-2 b^3 (b c-2 a d) \left (c^2+d^2\right ) \tan ^2(e+f x)-b^4 c \left (2 c^2+d^2\right )+d^2 \left (-d a^4+4 b c a^3+6 b^2 d a^2-4 b^3 c a-b^4 d\right ) \tan (e+f x)}{c+d \tan (e+f x)}dx}{d}-\frac {b^2 \left (a d (2 b c-a d)-b^2 \left (2 c^2+d^2\right )\right ) \tan (e+f x)}{d f}}{d \left (c^2+d^2\right )}-\frac {(b c-a d)^2 (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {\frac {\int \frac {c d^2 a^4+4 b d^3 a^3-6 b^2 c d^2 a^2+4 b^3 c^2 d a-2 b^3 (b c-2 a d) \left (c^2+d^2\right ) \tan ^2(e+f x)-b^4 c \left (2 c^2+d^2\right )+d^2 \left (-d a^4+4 b c a^3+6 b^2 d a^2-4 b^3 c a-b^4 d\right ) \tan (e+f x)}{c+d \tan (e+f x)}dx}{d}-\frac {b^2 \left (a d (2 b c-a d)-b^2 \left (2 c^2+d^2\right )\right ) \tan (e+f x)}{d f}}{d \left (c^2+d^2\right )}-\frac {(b c-a d)^2 (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\int \frac {c d^2 a^4+4 b d^3 a^3-6 b^2 c d^2 a^2+4 b^3 c^2 d a-2 b^3 (b c-2 a d) \left (c^2+d^2\right ) \tan (e+f x)^2-b^4 c \left (2 c^2+d^2\right )+d^2 \left (-d a^4+4 b c a^3+6 b^2 d a^2-4 b^3 c a-b^4 d\right ) \tan (e+f x)}{c+d \tan (e+f x)}dx}{d}-\frac {b^2 \left (a d (2 b c-a d)-b^2 \left (2 c^2+d^2\right )\right ) \tan (e+f x)}{d f}}{d \left (c^2+d^2\right )}-\frac {(b c-a d)^2 (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\)

\(\Big \downarrow \) 4109

\(\displaystyle \frac {\frac {\frac {2 d^2 \left (a^2 c+2 a b d-b^2 c\right ) \left (a^2 (-d)+2 a b c+b^2 d\right ) \int \tan (e+f x)dx}{c^2+d^2}-\frac {2 \left (a c d+b \left (c^2+2 d^2\right )\right ) (b c-a d)^3 \int \frac {\tan ^2(e+f x)+1}{c+d \tan (e+f x)}dx}{c^2+d^2}+\frac {d^2 x \left (a^4 \left (c^2-d^2\right )+8 a^3 b c d-6 a^2 b^2 \left (c^2-d^2\right )-8 a b^3 c d+b^4 \left (c^2-d^2\right )\right )}{c^2+d^2}}{d}-\frac {b^2 \left (a d (2 b c-a d)-b^2 \left (2 c^2+d^2\right )\right ) \tan (e+f x)}{d f}}{d \left (c^2+d^2\right )}-\frac {(b c-a d)^2 (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {\frac {2 d^2 \left (a^2 c+2 a b d-b^2 c\right ) \left (a^2 (-d)+2 a b c+b^2 d\right ) \int \tan (e+f x)dx}{c^2+d^2}-\frac {2 \left (a c d+b \left (c^2+2 d^2\right )\right ) (b c-a d)^3 \int \frac {\tan (e+f x)^2+1}{c+d \tan (e+f x)}dx}{c^2+d^2}+\frac {d^2 x \left (a^4 \left (c^2-d^2\right )+8 a^3 b c d-6 a^2 b^2 \left (c^2-d^2\right )-8 a b^3 c d+b^4 \left (c^2-d^2\right )\right )}{c^2+d^2}}{d}-\frac {b^2 \left (a d (2 b c-a d)-b^2 \left (2 c^2+d^2\right )\right ) \tan (e+f x)}{d f}}{d \left (c^2+d^2\right )}-\frac {(b c-a d)^2 (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {\frac {-\frac {2 \left (a c d+b \left (c^2+2 d^2\right )\right ) (b c-a d)^3 \int \frac {\tan (e+f x)^2+1}{c+d \tan (e+f x)}dx}{c^2+d^2}-\frac {2 d^2 \left (a^2 c+2 a b d-b^2 c\right ) \left (a^2 (-d)+2 a b c+b^2 d\right ) \log (\cos (e+f x))}{f \left (c^2+d^2\right )}+\frac {d^2 x \left (a^4 \left (c^2-d^2\right )+8 a^3 b c d-6 a^2 b^2 \left (c^2-d^2\right )-8 a b^3 c d+b^4 \left (c^2-d^2\right )\right )}{c^2+d^2}}{d}-\frac {b^2 \left (a d (2 b c-a d)-b^2 \left (2 c^2+d^2\right )\right ) \tan (e+f x)}{d f}}{d \left (c^2+d^2\right )}-\frac {(b c-a d)^2 (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\)

\(\Big \downarrow \) 4100

\(\displaystyle \frac {\frac {-\frac {2 \left (a c d+b \left (c^2+2 d^2\right )\right ) (b c-a d)^3 \int \frac {1}{c+d \tan (e+f x)}d(d \tan (e+f x))}{d f \left (c^2+d^2\right )}-\frac {2 d^2 \left (a^2 c+2 a b d-b^2 c\right ) \left (a^2 (-d)+2 a b c+b^2 d\right ) \log (\cos (e+f x))}{f \left (c^2+d^2\right )}+\frac {d^2 x \left (a^4 \left (c^2-d^2\right )+8 a^3 b c d-6 a^2 b^2 \left (c^2-d^2\right )-8 a b^3 c d+b^4 \left (c^2-d^2\right )\right )}{c^2+d^2}}{d}-\frac {b^2 \left (a d (2 b c-a d)-b^2 \left (2 c^2+d^2\right )\right ) \tan (e+f x)}{d f}}{d \left (c^2+d^2\right )}-\frac {(b c-a d)^2 (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\)

\(\Big \downarrow \) 16

\(\displaystyle \frac {\frac {-\frac {2 d^2 \left (a^2 c+2 a b d-b^2 c\right ) \left (a^2 (-d)+2 a b c+b^2 d\right ) \log (\cos (e+f x))}{f \left (c^2+d^2\right )}+\frac {d^2 x \left (a^4 \left (c^2-d^2\right )+8 a^3 b c d-6 a^2 b^2 \left (c^2-d^2\right )-8 a b^3 c d+b^4 \left (c^2-d^2\right )\right )}{c^2+d^2}-\frac {2 \left (a c d+b \left (c^2+2 d^2\right )\right ) (b c-a d)^3 \log (c+d \tan (e+f x))}{d f \left (c^2+d^2\right )}}{d}-\frac {b^2 \left (a d (2 b c-a d)-b^2 \left (2 c^2+d^2\right )\right ) \tan (e+f x)}{d f}}{d \left (c^2+d^2\right )}-\frac {(b c-a d)^2 (a+b \tan (e+f x))^2}{d f \left (c^2+d^2\right ) (c+d \tan (e+f x))}\)

input
Int[(a + b*Tan[e + f*x])^4/(c + d*Tan[e + f*x])^2,x]
 
output
-(((b*c - a*d)^2*(a + b*Tan[e + f*x])^2)/(d*(c^2 + d^2)*f*(c + d*Tan[e + f 
*x]))) + (((d^2*(8*a^3*b*c*d - 8*a*b^3*c*d + a^4*(c^2 - d^2) - 6*a^2*b^2*( 
c^2 - d^2) + b^4*(c^2 - d^2))*x)/(c^2 + d^2) - (2*d^2*(a^2*c - b^2*c + 2*a 
*b*d)*(2*a*b*c - a^2*d + b^2*d)*Log[Cos[e + f*x]])/((c^2 + d^2)*f) - (2*(b 
*c - a*d)^3*(a*c*d + b*(c^2 + 2*d^2))*Log[c + d*Tan[e + f*x]])/(d*(c^2 + d 
^2)*f))/d - (b^2*(a*d*(2*b*c - a*d) - b^2*(2*c^2 + d^2))*Tan[e + f*x])/(d* 
f))/(d*(c^2 + d^2))
 

3.13.16.3.1 Defintions of rubi rules used

rule 16
Int[(c_.)/((a_.) + (b_.)*(x_)), x_Symbol] :> Simp[c*(Log[RemoveContent[a + 
b*x, x]]/b), x] /; FreeQ[{a, b, c}, x]
 

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4048
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*c - a*d)^2*(a + b*Tan[e + f*x])^(m 
 - 2)*((c + d*Tan[e + f*x])^(n + 1)/(d*f*(n + 1)*(c^2 + d^2))), x] - Simp[1 
/(d*(n + 1)*(c^2 + d^2))   Int[(a + b*Tan[e + f*x])^(m - 3)*(c + d*Tan[e + 
f*x])^(n + 1)*Simp[a^2*d*(b*d*(m - 2) - a*c*(n + 1)) + b*(b*c - 2*a*d)*(b*c 
*(m - 2) + a*d*(n + 1)) - d*(n + 1)*(3*a^2*b*c - b^3*c - a^3*d + 3*a*b^2*d) 
*Tan[e + f*x] - b*(a*d*(2*b*c - a*d)*(m + n - 1) - b^2*(c^2*(m - 2) - d^2*( 
n + 1)))*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[ 
b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] && GtQ[m, 2] && LtQ 
[n, -1] && IntegerQ[2*m]
 

rule 4100
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*tan[(e_.) + 
 (f_.)*(x_)]^2), x_Symbol] :> Simp[A/(b*f)   Subst[Int[(a + x)^m, x], x, b* 
Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && EqQ[A, C]
 

rule 4109
Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2 
)/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*A + b*B - a 
*C)*(x/(a^2 + b^2)), x] + (Simp[(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2)   Int[( 
1 + Tan[e + f*x]^2)/(a + b*Tan[e + f*x]), x], x] - Simp[(A*b - a*B - b*C)/( 
a^2 + b^2)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, e, f, A, B, C}, x] & 
& NeQ[A*b^2 - a*b*B + a^2*C, 0] && NeQ[a^2 + b^2, 0] && NeQ[A*b - a*B - b*C 
, 0]
 

rule 4120
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)])^(n_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f 
_.)*(x_)]^2), x_Symbol] :> Simp[b*C*Tan[e + f*x]*((c + d*Tan[e + f*x])^(n + 
 1)/(d*f*(n + 2))), x] - Simp[1/(d*(n + 2))   Int[(c + d*Tan[e + f*x])^n*Si 
mp[b*c*C - a*A*d*(n + 2) - (A*b + a*B - b*C)*d*(n + 2)*Tan[e + f*x] - (a*C* 
d*(n + 2) - b*(c*C - B*d*(n + 2)))*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, 
b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && NeQ[c^2 + d^2, 0] && 
  !LtQ[n, -1]
 
3.13.16.4 Maple [A] (verified)

Time = 0.52 (sec) , antiderivative size = 364, normalized size of antiderivative = 1.28

method result size
derivativedivides \(\frac {\frac {b^{4} \tan \left (f x +e \right )}{d^{2}}+\frac {\frac {\left (-2 a^{4} c d +4 a^{3} b \,c^{2}-4 a^{3} b \,d^{2}+12 a^{2} b^{2} d c -4 a \,b^{3} c^{2}+4 a \,b^{3} d^{2}-2 b^{4} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{4} c^{2}-a^{4} d^{2}+8 a^{3} b c d -6 a^{2} b^{2} c^{2}+6 a^{2} b^{2} d^{2}-8 a \,b^{3} c d +b^{4} c^{2}-b^{4} d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}-\frac {a^{4} d^{4}-4 a^{3} b c \,d^{3}+6 a^{2} b^{2} c^{2} d^{2}-4 a \,b^{3} c^{3} d +b^{4} c^{4}}{d^{3} \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )}+\frac {\left (2 a^{4} c \,d^{4}-4 a^{3} b \,c^{2} d^{3}+4 a^{3} b \,d^{5}-12 a^{2} b^{2} c \,d^{4}+4 a \,b^{3} c^{4} d +12 a \,b^{3} c^{2} d^{3}-2 b^{4} c^{5}-4 b^{4} c^{3} d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{3} \left (c^{2}+d^{2}\right )^{2}}}{f}\) \(364\)
default \(\frac {\frac {b^{4} \tan \left (f x +e \right )}{d^{2}}+\frac {\frac {\left (-2 a^{4} c d +4 a^{3} b \,c^{2}-4 a^{3} b \,d^{2}+12 a^{2} b^{2} d c -4 a \,b^{3} c^{2}+4 a \,b^{3} d^{2}-2 b^{4} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{4} c^{2}-a^{4} d^{2}+8 a^{3} b c d -6 a^{2} b^{2} c^{2}+6 a^{2} b^{2} d^{2}-8 a \,b^{3} c d +b^{4} c^{2}-b^{4} d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{2}}-\frac {a^{4} d^{4}-4 a^{3} b c \,d^{3}+6 a^{2} b^{2} c^{2} d^{2}-4 a \,b^{3} c^{3} d +b^{4} c^{4}}{d^{3} \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )}+\frac {\left (2 a^{4} c \,d^{4}-4 a^{3} b \,c^{2} d^{3}+4 a^{3} b \,d^{5}-12 a^{2} b^{2} c \,d^{4}+4 a \,b^{3} c^{4} d +12 a \,b^{3} c^{2} d^{3}-2 b^{4} c^{5}-4 b^{4} c^{3} d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{3} \left (c^{2}+d^{2}\right )^{2}}}{f}\) \(364\)
norman \(\frac {\frac {b^{4} \left (\tan ^{2}\left (f x +e \right )\right )}{d f}+\frac {c \left (a^{4} c^{2}-a^{4} d^{2}+8 a^{3} b c d -6 a^{2} b^{2} c^{2}+6 a^{2} b^{2} d^{2}-8 a \,b^{3} c d +b^{4} c^{2}-b^{4} d^{2}\right ) x}{c^{4}+2 c^{2} d^{2}+d^{4}}+\frac {d \left (a^{4} c^{2}-a^{4} d^{2}+8 a^{3} b c d -6 a^{2} b^{2} c^{2}+6 a^{2} b^{2} d^{2}-8 a \,b^{3} c d +b^{4} c^{2}-b^{4} d^{2}\right ) x \tan \left (f x +e \right )}{c^{4}+2 c^{2} d^{2}+d^{4}}-\frac {a^{4} d^{4}-4 a^{3} b c \,d^{3}+6 a^{2} b^{2} c^{2} d^{2}-4 a \,b^{3} c^{3} d +2 b^{4} c^{4}+b^{4} c^{2} d^{2}}{f \,d^{3} \left (c^{2}+d^{2}\right )}}{c +d \tan \left (f x +e \right )}-\frac {\left (a^{4} c d -2 a^{3} b \,c^{2}+2 a^{3} b \,d^{2}-6 a^{2} b^{2} d c +2 a \,b^{3} c^{2}-2 a \,b^{3} d^{2}+b^{4} c d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}+\frac {2 \left (a^{4} c \,d^{4}-2 a^{3} b \,c^{2} d^{3}+2 a^{3} b \,d^{5}-6 a^{2} b^{2} c \,d^{4}+2 a \,b^{3} c^{4} d +6 a \,b^{3} c^{2} d^{3}-b^{4} c^{5}-2 b^{4} c^{3} d^{2}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{4}+2 c^{2} d^{2}+d^{4}\right ) d^{3} f}\) \(506\)
parallelrisch \(\text {Expression too large to display}\) \(1194\)
risch \(\text {Expression too large to display}\) \(1458\)

input
int((a+b*tan(f*x+e))^4/(c+d*tan(f*x+e))^2,x,method=_RETURNVERBOSE)
 
output
1/f*(b^4/d^2*tan(f*x+e)+1/(c^2+d^2)^2*(1/2*(-2*a^4*c*d+4*a^3*b*c^2-4*a^3*b 
*d^2+12*a^2*b^2*c*d-4*a*b^3*c^2+4*a*b^3*d^2-2*b^4*c*d)*ln(1+tan(f*x+e)^2)+ 
(a^4*c^2-a^4*d^2+8*a^3*b*c*d-6*a^2*b^2*c^2+6*a^2*b^2*d^2-8*a*b^3*c*d+b^4*c 
^2-b^4*d^2)*arctan(tan(f*x+e)))-1/d^3*(a^4*d^4-4*a^3*b*c*d^3+6*a^2*b^2*c^2 
*d^2-4*a*b^3*c^3*d+b^4*c^4)/(c^2+d^2)/(c+d*tan(f*x+e))+(2*a^4*c*d^4-4*a^3* 
b*c^2*d^3+4*a^3*b*d^5-12*a^2*b^2*c*d^4+4*a*b^3*c^4*d+12*a*b^3*c^2*d^3-2*b^ 
4*c^5-4*b^4*c^3*d^2)/d^3/(c^2+d^2)^2*ln(c+d*tan(f*x+e)))
 
3.13.16.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 704 vs. \(2 (284) = 568\).

Time = 0.41 (sec) , antiderivative size = 704, normalized size of antiderivative = 2.47 \[ \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^2} \, dx=-\frac {b^{4} c^{4} d^{2} - 4 \, a b^{3} c^{3} d^{3} + 6 \, a^{2} b^{2} c^{2} d^{4} - 4 \, a^{3} b c d^{5} + a^{4} d^{6} - {\left ({\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} c^{3} d^{3} + 8 \, {\left (a^{3} b - a b^{3}\right )} c^{2} d^{4} - {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} c d^{5}\right )} f x - {\left (b^{4} c^{4} d^{2} + 2 \, b^{4} c^{2} d^{4} + b^{4} d^{6}\right )} \tan \left (f x + e\right )^{2} + {\left (b^{4} c^{6} - 2 \, a b^{3} c^{5} d + 2 \, b^{4} c^{4} d^{2} - 2 \, a^{3} b c d^{5} + 2 \, {\left (a^{3} b - 3 \, a b^{3}\right )} c^{3} d^{3} - {\left (a^{4} - 6 \, a^{2} b^{2}\right )} c^{2} d^{4} + {\left (b^{4} c^{5} d - 2 \, a b^{3} c^{4} d^{2} + 2 \, b^{4} c^{3} d^{3} - 2 \, a^{3} b d^{6} + 2 \, {\left (a^{3} b - 3 \, a b^{3}\right )} c^{2} d^{4} - {\left (a^{4} - 6 \, a^{2} b^{2}\right )} c d^{5}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - {\left (b^{4} c^{6} - 2 \, a b^{3} c^{5} d + 2 \, b^{4} c^{4} d^{2} - 4 \, a b^{3} c^{3} d^{3} + b^{4} c^{2} d^{4} - 2 \, a b^{3} c d^{5} + {\left (b^{4} c^{5} d - 2 \, a b^{3} c^{4} d^{2} + 2 \, b^{4} c^{3} d^{3} - 4 \, a b^{3} c^{2} d^{4} + b^{4} c d^{5} - 2 \, a b^{3} d^{6}\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) - {\left (2 \, b^{4} c^{5} d - 4 \, a b^{3} c^{4} d^{2} - 4 \, a^{3} b c^{2} d^{4} + 2 \, {\left (3 \, a^{2} b^{2} + b^{4}\right )} c^{3} d^{3} + {\left (a^{4} + b^{4}\right )} c d^{5} + {\left ({\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} c^{2} d^{4} + 8 \, {\left (a^{3} b - a b^{3}\right )} c d^{5} - {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} d^{6}\right )} f x\right )} \tan \left (f x + e\right )}{{\left (c^{4} d^{4} + 2 \, c^{2} d^{6} + d^{8}\right )} f \tan \left (f x + e\right ) + {\left (c^{5} d^{3} + 2 \, c^{3} d^{5} + c d^{7}\right )} f} \]

input
integrate((a+b*tan(f*x+e))^4/(c+d*tan(f*x+e))^2,x, algorithm="fricas")
 
output
-(b^4*c^4*d^2 - 4*a*b^3*c^3*d^3 + 6*a^2*b^2*c^2*d^4 - 4*a^3*b*c*d^5 + a^4* 
d^6 - ((a^4 - 6*a^2*b^2 + b^4)*c^3*d^3 + 8*(a^3*b - a*b^3)*c^2*d^4 - (a^4 
- 6*a^2*b^2 + b^4)*c*d^5)*f*x - (b^4*c^4*d^2 + 2*b^4*c^2*d^4 + b^4*d^6)*ta 
n(f*x + e)^2 + (b^4*c^6 - 2*a*b^3*c^5*d + 2*b^4*c^4*d^2 - 2*a^3*b*c*d^5 + 
2*(a^3*b - 3*a*b^3)*c^3*d^3 - (a^4 - 6*a^2*b^2)*c^2*d^4 + (b^4*c^5*d - 2*a 
*b^3*c^4*d^2 + 2*b^4*c^3*d^3 - 2*a^3*b*d^6 + 2*(a^3*b - 3*a*b^3)*c^2*d^4 - 
 (a^4 - 6*a^2*b^2)*c*d^5)*tan(f*x + e))*log((d^2*tan(f*x + e)^2 + 2*c*d*ta 
n(f*x + e) + c^2)/(tan(f*x + e)^2 + 1)) - (b^4*c^6 - 2*a*b^3*c^5*d + 2*b^4 
*c^4*d^2 - 4*a*b^3*c^3*d^3 + b^4*c^2*d^4 - 2*a*b^3*c*d^5 + (b^4*c^5*d - 2* 
a*b^3*c^4*d^2 + 2*b^4*c^3*d^3 - 4*a*b^3*c^2*d^4 + b^4*c*d^5 - 2*a*b^3*d^6) 
*tan(f*x + e))*log(1/(tan(f*x + e)^2 + 1)) - (2*b^4*c^5*d - 4*a*b^3*c^4*d^ 
2 - 4*a^3*b*c^2*d^4 + 2*(3*a^2*b^2 + b^4)*c^3*d^3 + (a^4 + b^4)*c*d^5 + (( 
a^4 - 6*a^2*b^2 + b^4)*c^2*d^4 + 8*(a^3*b - a*b^3)*c*d^5 - (a^4 - 6*a^2*b^ 
2 + b^4)*d^6)*f*x)*tan(f*x + e))/((c^4*d^4 + 2*c^2*d^6 + d^8)*f*tan(f*x + 
e) + (c^5*d^3 + 2*c^3*d^5 + c*d^7)*f)
 
3.13.16.6 Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 1.79 (sec) , antiderivative size = 8928, normalized size of antiderivative = 31.33 \[ \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^2} \, dx=\text {Too large to display} \]

input
integrate((a+b*tan(f*x+e))**4/(c+d*tan(f*x+e))**2,x)
 
output
Piecewise((zoo*x*(a + b*tan(e))**4/tan(e)**2, Eq(c, 0) & Eq(d, 0) & Eq(f, 
0)), ((a**4*x + 2*a**3*b*log(tan(e + f*x)**2 + 1)/f - 6*a**2*b**2*x + 6*a* 
*2*b**2*tan(e + f*x)/f - 2*a*b**3*log(tan(e + f*x)**2 + 1)/f + 2*a*b**3*ta 
n(e + f*x)**2/f + b**4*x + b**4*tan(e + f*x)**3/(3*f) - b**4*tan(e + f*x)/ 
f)/c**2, Eq(d, 0)), (-a**4*f*x*tan(e + f*x)**2/(4*d**2*f*tan(e + f*x)**2 - 
 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 2*I*a**4*f*x*tan(e + f*x)/(4*d**2*f 
*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + a**4*f*x/(4*d**2* 
f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) - a**4*tan(e + f*x 
)/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 2*I*a* 
*4/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 4*I*a 
**3*b*f*x*tan(e + f*x)**2/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f 
*x) - 4*d**2*f) + 8*a**3*b*f*x*tan(e + f*x)/(4*d**2*f*tan(e + f*x)**2 - 8* 
I*d**2*f*tan(e + f*x) - 4*d**2*f) - 4*I*a**3*b*f*x/(4*d**2*f*tan(e + f*x)* 
*2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 4*I*a**3*b*tan(e + f*x)/(4*d**2 
*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 6*a**2*b**2*f*x 
*tan(e + f*x)**2/(4*d**2*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d 
**2*f) - 12*I*a**2*b**2*f*x*tan(e + f*x)/(4*d**2*f*tan(e + f*x)**2 - 8*I*d 
**2*f*tan(e + f*x) - 4*d**2*f) - 6*a**2*b**2*f*x/(4*d**2*f*tan(e + f*x)**2 
 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) - 18*a**2*b**2*tan(e + f*x)/(4*d**2 
*f*tan(e + f*x)**2 - 8*I*d**2*f*tan(e + f*x) - 4*d**2*f) + 12*I*a**2*b*...
 
3.13.16.7 Maxima [A] (verification not implemented)

Time = 0.72 (sec) , antiderivative size = 374, normalized size of antiderivative = 1.31 \[ \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^2} \, dx=\frac {\frac {b^{4} \tan \left (f x + e\right )}{d^{2}} + \frac {{\left ({\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} c^{2} + 8 \, {\left (a^{3} b - a b^{3}\right )} c d - {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} d^{2}\right )} {\left (f x + e\right )}}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} - \frac {2 \, {\left (b^{4} c^{5} - 2 \, a b^{3} c^{4} d + 2 \, b^{4} c^{3} d^{2} - 2 \, a^{3} b d^{5} + 2 \, {\left (a^{3} b - 3 \, a b^{3}\right )} c^{2} d^{3} - {\left (a^{4} - 6 \, a^{2} b^{2}\right )} c d^{4}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{4} d^{3} + 2 \, c^{2} d^{5} + d^{7}} + \frac {{\left (2 \, {\left (a^{3} b - a b^{3}\right )} c^{2} - {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} c d - 2 \, {\left (a^{3} b - a b^{3}\right )} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} - \frac {b^{4} c^{4} - 4 \, a b^{3} c^{3} d + 6 \, a^{2} b^{2} c^{2} d^{2} - 4 \, a^{3} b c d^{3} + a^{4} d^{4}}{c^{3} d^{3} + c d^{5} + {\left (c^{2} d^{4} + d^{6}\right )} \tan \left (f x + e\right )}}{f} \]

input
integrate((a+b*tan(f*x+e))^4/(c+d*tan(f*x+e))^2,x, algorithm="maxima")
 
output
(b^4*tan(f*x + e)/d^2 + ((a^4 - 6*a^2*b^2 + b^4)*c^2 + 8*(a^3*b - a*b^3)*c 
*d - (a^4 - 6*a^2*b^2 + b^4)*d^2)*(f*x + e)/(c^4 + 2*c^2*d^2 + d^4) - 2*(b 
^4*c^5 - 2*a*b^3*c^4*d + 2*b^4*c^3*d^2 - 2*a^3*b*d^5 + 2*(a^3*b - 3*a*b^3) 
*c^2*d^3 - (a^4 - 6*a^2*b^2)*c*d^4)*log(d*tan(f*x + e) + c)/(c^4*d^3 + 2*c 
^2*d^5 + d^7) + (2*(a^3*b - a*b^3)*c^2 - (a^4 - 6*a^2*b^2 + b^4)*c*d - 2*( 
a^3*b - a*b^3)*d^2)*log(tan(f*x + e)^2 + 1)/(c^4 + 2*c^2*d^2 + d^4) - (b^4 
*c^4 - 4*a*b^3*c^3*d + 6*a^2*b^2*c^2*d^2 - 4*a^3*b*c*d^3 + a^4*d^4)/(c^3*d 
^3 + c*d^5 + (c^2*d^4 + d^6)*tan(f*x + e)))/f
 
3.13.16.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 576 vs. \(2 (284) = 568\).

Time = 1.04 (sec) , antiderivative size = 576, normalized size of antiderivative = 2.02 \[ \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^2} \, dx=\frac {\frac {b^{4} \tan \left (f x + e\right )}{d^{2}} + \frac {{\left (a^{4} c^{2} - 6 \, a^{2} b^{2} c^{2} + b^{4} c^{2} + 8 \, a^{3} b c d - 8 \, a b^{3} c d - a^{4} d^{2} + 6 \, a^{2} b^{2} d^{2} - b^{4} d^{2}\right )} {\left (f x + e\right )}}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} + \frac {{\left (2 \, a^{3} b c^{2} - 2 \, a b^{3} c^{2} - a^{4} c d + 6 \, a^{2} b^{2} c d - b^{4} c d - 2 \, a^{3} b d^{2} + 2 \, a b^{3} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{4} + 2 \, c^{2} d^{2} + d^{4}} - \frac {2 \, {\left (b^{4} c^{5} - 2 \, a b^{3} c^{4} d + 2 \, b^{4} c^{3} d^{2} + 2 \, a^{3} b c^{2} d^{3} - 6 \, a b^{3} c^{2} d^{3} - a^{4} c d^{4} + 6 \, a^{2} b^{2} c d^{4} - 2 \, a^{3} b d^{5}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{4} d^{3} + 2 \, c^{2} d^{5} + d^{7}} + \frac {2 \, b^{4} c^{5} d \tan \left (f x + e\right ) - 4 \, a b^{3} c^{4} d^{2} \tan \left (f x + e\right ) + 4 \, b^{4} c^{3} d^{3} \tan \left (f x + e\right ) + 4 \, a^{3} b c^{2} d^{4} \tan \left (f x + e\right ) - 12 \, a b^{3} c^{2} d^{4} \tan \left (f x + e\right ) - 2 \, a^{4} c d^{5} \tan \left (f x + e\right ) + 12 \, a^{2} b^{2} c d^{5} \tan \left (f x + e\right ) - 4 \, a^{3} b d^{6} \tan \left (f x + e\right ) + b^{4} c^{6} - 6 \, a^{2} b^{2} c^{4} d^{2} + 3 \, b^{4} c^{4} d^{2} + 8 \, a^{3} b c^{3} d^{3} - 8 \, a b^{3} c^{3} d^{3} - 3 \, a^{4} c^{2} d^{4} + 6 \, a^{2} b^{2} c^{2} d^{4} - a^{4} d^{6}}{{\left (c^{4} d^{3} + 2 \, c^{2} d^{5} + d^{7}\right )} {\left (d \tan \left (f x + e\right ) + c\right )}}}{f} \]

input
integrate((a+b*tan(f*x+e))^4/(c+d*tan(f*x+e))^2,x, algorithm="giac")
 
output
(b^4*tan(f*x + e)/d^2 + (a^4*c^2 - 6*a^2*b^2*c^2 + b^4*c^2 + 8*a^3*b*c*d - 
 8*a*b^3*c*d - a^4*d^2 + 6*a^2*b^2*d^2 - b^4*d^2)*(f*x + e)/(c^4 + 2*c^2*d 
^2 + d^4) + (2*a^3*b*c^2 - 2*a*b^3*c^2 - a^4*c*d + 6*a^2*b^2*c*d - b^4*c*d 
 - 2*a^3*b*d^2 + 2*a*b^3*d^2)*log(tan(f*x + e)^2 + 1)/(c^4 + 2*c^2*d^2 + d 
^4) - 2*(b^4*c^5 - 2*a*b^3*c^4*d + 2*b^4*c^3*d^2 + 2*a^3*b*c^2*d^3 - 6*a*b 
^3*c^2*d^3 - a^4*c*d^4 + 6*a^2*b^2*c*d^4 - 2*a^3*b*d^5)*log(abs(d*tan(f*x 
+ e) + c))/(c^4*d^3 + 2*c^2*d^5 + d^7) + (2*b^4*c^5*d*tan(f*x + e) - 4*a*b 
^3*c^4*d^2*tan(f*x + e) + 4*b^4*c^3*d^3*tan(f*x + e) + 4*a^3*b*c^2*d^4*tan 
(f*x + e) - 12*a*b^3*c^2*d^4*tan(f*x + e) - 2*a^4*c*d^5*tan(f*x + e) + 12* 
a^2*b^2*c*d^5*tan(f*x + e) - 4*a^3*b*d^6*tan(f*x + e) + b^4*c^6 - 6*a^2*b^ 
2*c^4*d^2 + 3*b^4*c^4*d^2 + 8*a^3*b*c^3*d^3 - 8*a*b^3*c^3*d^3 - 3*a^4*c^2* 
d^4 + 6*a^2*b^2*c^2*d^4 - a^4*d^6)/((c^4*d^3 + 2*c^2*d^5 + d^7)*(d*tan(f*x 
 + e) + c)))/f
 
3.13.16.9 Mupad [B] (verification not implemented)

Time = 11.95 (sec) , antiderivative size = 347, normalized size of antiderivative = 1.22 \[ \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^2} \, dx=\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (d^3\,\left (12\,a\,b^3\,c^2-4\,a^3\,b\,c^2\right )+d^4\,\left (2\,a^4\,c-12\,a^2\,b^2\,c\right )-2\,b^4\,c^5+4\,a^3\,b\,d^5-4\,b^4\,c^3\,d^2+4\,a\,b^3\,c^4\,d\right )}{f\,\left (c^4\,d^3+2\,c^2\,d^5+d^7\right )}+\frac {b^4\,\mathrm {tan}\left (e+f\,x\right )}{d^2\,f}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (a^4+a^3\,b\,4{}\mathrm {i}-6\,a^2\,b^2-a\,b^3\,4{}\mathrm {i}+b^4\right )}{2\,f\,\left (-c^2\,1{}\mathrm {i}+2\,c\,d+d^2\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (a^4\,1{}\mathrm {i}+4\,a^3\,b-a^2\,b^2\,6{}\mathrm {i}-4\,a\,b^3+b^4\,1{}\mathrm {i}\right )}{2\,f\,\left (-c^2+c\,d\,2{}\mathrm {i}+d^2\right )}-\frac {a^4\,d^4-4\,a^3\,b\,c\,d^3+6\,a^2\,b^2\,c^2\,d^2-4\,a\,b^3\,c^3\,d+b^4\,c^4}{d\,f\,\left (\mathrm {tan}\left (e+f\,x\right )\,d^3+c\,d^2\right )\,\left (c^2+d^2\right )} \]

input
int((a + b*tan(e + f*x))^4/(c + d*tan(e + f*x))^2,x)
 
output
(log(c + d*tan(e + f*x))*(d^3*(12*a*b^3*c^2 - 4*a^3*b*c^2) + d^4*(2*a^4*c 
- 12*a^2*b^2*c) - 2*b^4*c^5 + 4*a^3*b*d^5 - 4*b^4*c^3*d^2 + 4*a*b^3*c^4*d) 
)/(f*(d^7 + 2*c^2*d^5 + c^4*d^3)) + (b^4*tan(e + f*x))/(d^2*f) - (log(tan( 
e + f*x) - 1i)*(a^3*b*4i - a*b^3*4i + a^4 + b^4 - 6*a^2*b^2))/(2*f*(2*c*d 
- c^2*1i + d^2*1i)) - (log(tan(e + f*x) + 1i)*(4*a^3*b - 4*a*b^3 + a^4*1i 
+ b^4*1i - a^2*b^2*6i))/(2*f*(c*d*2i - c^2 + d^2)) - (a^4*d^4 + b^4*c^4 + 
6*a^2*b^2*c^2*d^2 - 4*a*b^3*c^3*d - 4*a^3*b*c*d^3)/(d*f*(c*d^2 + d^3*tan(e 
 + f*x))*(c^2 + d^2))